﻿using BLL;
using CrystalDecisions.CrystalReports.Engine;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using IYASAKAReport;

namespace IYAKASAPortal.PrintAll
{
    public class SetHBDateSource
    {
        /// <summary>
        /// 绑定自由加速不透光
        /// </summary>
        /// <param name="strKey"></param>
        /// <param name="strPath"></param>
        /// <returns></returns>
        public ReportDocument BindPF_X4_BTG_ReportEx(string strKey, string strPath)
        {
            ReportDocument document = new ReportDocument();
            document.Load(strPath);

            RESULT_VEHICLE_INFO_BLL bll = new RESULT_VEHICLE_INFO_BLL();
            var vehicleInfo = bll.GetModelList("ID=" + strKey);

            PQReport pqReport = new PQReport(vehicleInfo[0], true);
            rpt.DsHB_BTG ds = new rpt.DsHB_BTG();

            ds = (rpt.DsHB_BTG)pqReport.BindPQ_BTG_X4(ds);
            document.SetDataSource(ds);
            return document;
        }

        /// <summary>
        /// 绑定加载减速
        /// </summary>
        /// <param name="strKey"></param>
        /// <param name="strPath"></param>
        /// <returns></returns>
        public ReportDocument BindPF_PQYD_ReportEx(string strKey, string strPath)
        {
            ReportDocument document = new ReportDocument();
            document.Load(strPath);

            RESULT_VEHICLE_INFO_BLL bll = new RESULT_VEHICLE_INFO_BLL();
            var vehicleInfo = bll.GetModelList("ID=" + strKey);

            PQReport pqReport = new PQReport(vehicleInfo[0], true);
            rpt.DsHB_PQYD ds = new rpt.DsHB_PQYD();

            ds = (rpt.DsHB_PQYD)pqReport.BindPQ_JZJS_X5(ds);
            document.SetDataSource(ds);
            return document;
        }

        /// <summary>
        /// 双怠速
        /// </summary>
        /// <param name="strKey"></param>
        /// <param name="strPath"></param>
        /// <returns></returns>
        public ReportDocument BindPF_X1_SDS_ReportEx(string strKey, string strPath)
        {
            ReportDocument document = new ReportDocument();
            document.Load(strPath);

            RESULT_VEHICLE_INFO_BLL bll = new RESULT_VEHICLE_INFO_BLL();
            var vehicleInfo = bll.GetModelList("ID=" + strKey);

            PQReport pqReport = new PQReport(vehicleInfo[0], true);
            rpt.DsHB_SDS ds = new rpt.DsHB_SDS();

            ds = (rpt.DsHB_SDS)pqReport.BindPQ_SDS_X1(ds);
            document.SetDataSource(ds);
            return document;
        }

        /// <summary>
        /// VMAS 瞬态工况
        /// </summary>
        /// <param name="strKey"></param>
        /// <param name="strPath"></param>
        /// <returns></returns>
        public ReportDocument BingPF_X3_VMAS_ReportEx(string strKey, string strPath)
        {
            ReportDocument document = new ReportDocument();
            document.Load(strPath);

            RESULT_VEHICLE_INFO_BLL bll = new RESULT_VEHICLE_INFO_BLL();
            var vehicleInfo = bll.GetModelList("ID=" + strKey);

            PQReport pqReport = new PQReport(vehicleInfo[0], true);
            rpt.DsHB_STGK ds = new rpt.DsHB_STGK();

            ds = (rpt.DsHB_STGK)pqReport.BindPQ_VMAS_X3(ds);
            document.SetDataSource(ds);
            return document;
        }

        /// <summary>
        /// 滤纸
        /// </summary>
        /// <param name="strKey"></param>
        /// <param name="strPath"></param>
        /// <returns></returns>
        public ReportDocument BindPF_X6_LZS_ReportEx(string strKey, string strPath)
        {
            ReportDocument document = new ReportDocument();
            document.Load(strPath);

            RESULT_VEHICLE_INFO_BLL bll = new RESULT_VEHICLE_INFO_BLL();
            var vehicleInfo = bll.GetModelList("ID=" + strKey);

            PQReport pqReport = new PQReport(vehicleInfo[0], true);
            rpt.DsJSDJ ds = new rpt.DsJSDJ();

            ds = (rpt.DsJSDJ)pqReport.BindPQ_LVZ_X6(ds);
            document.SetDataSource(ds);
            return document;
        }
    }
}